'''
输入成员信息页面
'''
import allure
from appium.webdriver.common.appiumby import AppiumBy

from wework_frame.base.wework_app import WeWorkApp


class InputPage(WeWorkApp):
    __NAME = AppiumBy.XPATH, "//*[@text='必填']"
    __PHONE = AppiumBy.XPATH, "//*[@text='手机']/..//*[@text='选填']"
    __SAVE_BTN = AppiumBy.XPATH, "//*[@text='保存']"

    @allure.step("输入成员信息并保存")
    def quick_add_member(self, name, phone):
        # self.driver.find_element(AppiumBy.XPATH, "//*[@text='必填']").send_keys(name)
        # self.driver.find_element().send_keys(phone)
        # self.driver.find_element(AppiumBy.XPATH, "//*[@text='保存']").click()
        self.find_and_sendkeys(*self.__NAME, name)
        self.find_and_sendkeys(*self.__PHONE, phone)
        self.find_and_click(*self.__SAVE_BTN)
        from wework_frame.page.add_member_page import AddMemberPage
        return AddMemberPage(self.driver)
